package com.vista.producto;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.table.TableColumn;

import utilitario.JTextFieldChanged;
import utilitario.JTextFieldFormatoEntero;

import com.controlador.Manejador;
import com.controlador.Manejador.AccesoPagina;
import com.controlador.Manejador.EstadoPagina;
import com.utilidades.CeldaRenderGeneral;
import com.vista.FrmPrincipal;
import com.vista.InterfaceUsuario;

/**
 * 
 * @author Hernan
 */
public class DlgGrupo extends javax.swing.JDialog implements InterfaceUsuario {

	/*
	 * Variables principales
	 */
	public EstadoPagina estDlgCat, estDlgSer, estDlgDet;
	public AccesoPagina acceso;
	public Manejador man;
	public String padre;
	public boolean frmAbierto;
	private CeldaRenderGeneral celdaRenderGeneral;
	private TableColumn[] colTabCat;
	private int bookMarkCatCod, bookMarkSerCod, bookMarkDetCod;
	private String resInpCat;
	private String resInpSer;
	private String resInpDet;

	/**
	 * Creates new form DlgGrupo
	 */
	public DlgGrupo(FrmPrincipal parent) {
		super(parent, true);
		initComponents();

	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {
		scrTabGru = new javax.swing.JScrollPane();
		tabGru = new javax.swing.JTable();
		cmdKarCerrar = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		getContentPane().setLayout(null);

		scrTabGru.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

		tabGru.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ null },
						{ null },
						{ null },
						{ null }
				},
				new String[] {
						"Categoria"
				}
				));
		tabGru.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
		tabGru.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mousePressed(java.awt.event.MouseEvent evt) {
				tabCatMousePressed(evt);
			}
		});
		tabGru.addKeyListener(new java.awt.event.KeyAdapter() {
			public void keyReleased(java.awt.event.KeyEvent evt) {
				tabCatKeyReleased(evt);
			}
		});
		scrTabGru.setViewportView(tabGru);

		getContentPane().add(scrTabGru);
		scrTabGru.setBounds(14, 151, 494, 180);

		cmdKarCerrar.setIcon(new ImageIcon(DlgGrupo.class.getResource("/com/vista/img/cancelar.png"))); // NOI18N
		cmdKarCerrar.setText("Cerrar");
		cmdKarCerrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
		cmdKarCerrar.setMargin(new java.awt.Insets(0, 0, 0, 0));
		cmdKarCerrar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/com/vista/img/CerrarDown.png"))); // NOI18N
		cmdKarCerrar.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				cmdKarCerrarActionPerformed(evt);
			}
		});
		getContentPane().add(cmdKarCerrar);
		cmdKarCerrar.setBounds(400, 335, 100, 40);

		button = new JButton();
		button.setIcon(new ImageIcon(DlgGrupo.class.getResource("/com/vista/img/agregar.png")));
		button.setText("Agregar");
		button.setMargin(new Insets(0, 0, 0, 0));
		button.setFont(new Font("Tahoma", Font.PLAIN, 14));
		button.setBounds(14, 334, 100, 40);
		getContentPane().add(button);

		button_1 = new JButton();
		button_1.setIcon(new ImageIcon(DlgGrupo.class.getResource("/com/vista/img/modificar.png")));
		button_1.setText("Modificar");
		button_1.setMargin(new Insets(0, 0, 0, 0));
		button_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
		button_1.setBounds(113, 334, 100, 40);
		getContentPane().add(button_1);

		button_2 = new JButton();
		button_2.setIcon(new ImageIcon(DlgGrupo.class.getResource("/com/vista/img/buscar.png")));
		button_2.setText("Buscar");
		button_2.setMargin(new Insets(0, 0, 0, 0));
		button_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
		button_2.setBounds(213, 334, 100, 40);
		getContentPane().add(button_2);

		JLabel lblAlias = new JLabel();
		lblAlias.setText("Alias");
		lblAlias.setHorizontalAlignment(SwingConstants.CENTER);
		lblAlias.setFont(new Font("Tahoma", Font.PLAIN, 11));
		lblAlias.setBounds(129, 53, 103, 20);
		getContentPane().add(lblAlias);

		JTextFieldChanged txtGruAlias = new JTextFieldChanged(100);
		txtGruAlias.setBounds(129, 71, 103, 20);
		getContentPane().add(txtGruAlias);

		JTextFieldChanged txtGruDes = new JTextFieldChanged(200);
		txtGruDes.setBounds(241, 71, 267, 20);
		getContentPane().add(txtGruDes);

		JLabel lblNombre = new JLabel();
		lblNombre.setText("Descripcion del Grupo");
		lblNombre.setHorizontalAlignment(SwingConstants.CENTER);
		lblNombre.setFont(new Font("Tahoma", Font.PLAIN, 11));
		lblNombre.setBounds(241, 53, 267, 20);
		getContentPane().add(lblNombre);

		JComboBox cmbGruTipo = new JComboBox();
		cmbGruTipo.setBounds(14, 71, 105, 20);
		getContentPane().add(cmbGruTipo);

		JLabel lblTipo = new JLabel();
		lblTipo.setFont(new Font("Tahoma", Font.PLAIN, 11));
		lblTipo.setText("Tipo");
		lblTipo.setHorizontalAlignment(SwingConstants.CENTER);
		lblTipo.setBounds(14, 53, 105, 20);
		getContentPane().add(lblTipo);

		JLabel label = new JLabel();
		label.setText("Nivel");
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setBounds(10, 11, 60, 20);
		getContentPane().add(label);

		JComboBox cmbGruNivel = new JComboBox();
		cmbGruNivel.setBounds(10, 31, 60, 22);
		getContentPane().add(cmbGruNivel);

		JTextFieldFormatoEntero txtGruCod = new JTextFieldFormatoEntero(5);
		txtGruCod.setHorizontalAlignment(SwingConstants.CENTER);
		txtGruCod.setBounds(80, 31, 80, 20);
		getContentPane().add(txtGruCod);

		JLabel lblGrupo = new JLabel();
		lblGrupo.setText("Grupo");
		lblGrupo.setHorizontalAlignment(SwingConstants.CENTER);
		lblGrupo.setBounds(80, 11, 80, 20);
		getContentPane().add(lblGrupo);

		JLabel lblNombreDelGrupo = new JLabel();
		lblNombreDelGrupo.setText("Nombre del Grupo");
		lblNombreDelGrupo.setHorizontalAlignment(SwingConstants.CENTER);
		lblNombreDelGrupo.setBounds(173, 11, 335, 20);
		getContentPane().add(lblNombreDelGrupo);

		JTextFieldChanged txtGruNom = new JTextFieldChanged(100);
		txtGruNom.setText("Caja y Bancos");
		txtGruNom.setBounds(173, 31, 335, 20);
		getContentPane().add(txtGruNom);

		JLabel etiHeadSupUno = new JLabel();
		etiHeadSupUno.setText("Sup Uno");
		etiHeadSupUno.setHorizontalAlignment(SwingConstants.CENTER);
		etiHeadSupUno.setBounds(14, 102, 60, 20);
		getContentPane().add(etiHeadSupUno);

		JLabel etiHeadSupDos = new JLabel();
		etiHeadSupDos.setText("Sup - Dos");
		etiHeadSupDos.setHorizontalAlignment(SwingConstants.CENTER);
		etiHeadSupDos.setBounds(77, 102, 60, 20);
		getContentPane().add(etiHeadSupDos);

		JLabel etiHeadSupTres = new JLabel();
		etiHeadSupTres.setText("Sup Tres");
		etiHeadSupTres.setHorizontalAlignment(SwingConstants.CENTER);
		etiHeadSupTres.setBounds(142, 102, 60, 20);
		getContentPane().add(etiHeadSupTres);

		JLabel etiSupUno = new JLabel();
		etiSupUno.setHorizontalAlignment(SwingConstants.CENTER);
		etiSupUno.setBounds(14, 120, 60, 20);
		getContentPane().add(etiSupUno);

		JLabel etiSupDos = new JLabel();
		etiSupDos.setHorizontalAlignment(SwingConstants.CENTER);
		etiSupDos.setBounds(77, 120, 60, 20);
		getContentPane().add(etiSupDos);

		JLabel etiSupTres = new JLabel();
		etiSupTres.setHorizontalAlignment(SwingConstants.CENTER);
		etiSupTres.setBounds(142, 120, 60, 20);
		getContentPane().add(etiSupTres);

		JLabel lblNombreDeLa = new JLabel();
		lblNombreDeLa.setText("Nombre de la Grupo Superior");
		lblNombreDeLa.setHorizontalAlignment(SwingConstants.CENTER);
		lblNombreDeLa.setBounds(264, 100, 244, 20);
		getContentPane().add(lblNombreDeLa);

		JTextFieldChanged textFieldChanged = new JTextFieldChanged(100);
		textFieldChanged.setText("Cuenta para registrar los ingreso y salidas de la caja");
		textFieldChanged.setBounds(264, 120, 244, 20);
		getContentPane().add(textFieldChanged);

		JLabel lblSupCua = new JLabel();
		lblSupCua.setText("Sup - Cua");
		lblSupCua.setHorizontalAlignment(SwingConstants.CENTER);
		lblSupCua.setBounds(201, 102, 60, 20);
		getContentPane().add(lblSupCua);

		JLabel etiSupCua = new JLabel();
		etiSupCua.setHorizontalAlignment(SwingConstants.CENTER);
		etiSupCua.setBounds(201, 120, 60, 20);
		getContentPane().add(etiSupCua);

		setSize(new Dimension(526, 413));
		setLocationRelativeTo(null);
	}// </editor-fold>//GEN-END:initComponents

	private void cmdKarCerrarActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cmdKarCerrarActionPerformed
		cerrar();
	}// GEN-LAST:event_cmdKarCerrarActionPerformed

	private void tabCatKeyReleased(java.awt.event.KeyEvent evt) {// GEN-FIRST:event_tabCatKeyReleased
		if (evt.getKeyCode() == KeyEvent.VK_UP
				|| evt.getKeyCode() == KeyEvent.VK_DOWN
				|| evt.getKeyCode() == KeyEvent.VK_PAGE_UP
				|| evt.getKeyCode() == KeyEvent.VK_PAGE_DOWN
				|| evt.getKeyCode() == KeyEvent.VK_ENTER
				|| evt.getKeyCode() == KeyEvent.VK_F2
				|| evt.getKeyCode() == KeyEvent.VK_TAB) {

			tabCatMousePressed(null);

		}
	}// GEN-LAST:event_tabCatKeyReleased

	private void tabCatMousePressed(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_tabCatMousePressed
		if (tabGru.getSelectedRow() > -1) {

		}// FIN DE VERIFICAR QUE EL REGISTRO SELECCIONADO ESTE EN LA TABLA
	}// GEN-LAST:event_tabCatMousePressed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		// <editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
		 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(DlgGrupo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(DlgGrupo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(DlgGrupo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(DlgGrupo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/* Create and display the dialog */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				DlgGrupo dialog = new DlgGrupo(null);
				dialog.addWindowListener(new java.awt.event.WindowAdapter() {
					@Override
					public void windowClosing(java.awt.event.WindowEvent e) {
						System.exit(0);
					}
				});
				dialog.setVisible(true);
			}
		});
	}

	private javax.swing.JButton cmdKarCerrar;
	private javax.swing.JScrollPane scrTabGru;
	private javax.swing.JTable tabGru;
	private JButton button;
	private JButton button_1;
	private JButton button_2;

	// End of variables declaration//GEN-END:variables

	@Override
	public void iniciarFormulario() {
		// TODO Auto-generated method stub

	}

	@Override
	public void iniciarInstancias() {
		// TODO Auto-generated method stub

	}

	@Override
	public void limpiarInstancias(AccesoPagina parAcceso) {
		// TODO Auto-generated method stub

	}

	@Override
	public void limpiarFormulario() {
		// TODO Auto-generated method stub

	}

	@Override
	public void generarNuevoRegistro() {
		// TODO Auto-generated method stub

	}

	@Override
	public void llenarFormulario() {
		// TODO Auto-generated method stub

	}

	@Override
	public void activarFormulario(boolean parAct) {
		// TODO Auto-generated method stub

	}

	@Override
	public void refrescarFormulario() {
		// TODO Auto-generated method stub

	}

	@Override
	public void obtenerDatoFormulario() {
		// TODO Auto-generated method stub

	}

	@Override
	public void obtenerDatoBaseDato() {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean validarFormulario() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean guardarDatoBaseDato(String parModoGrabar) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setManejador(Manejador parMan) {
		// TODO Auto-generated method stub

	}

	@Override
	public void cerrar() {
		// TODO Auto-generated method stub

	}
}
